﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TweetMyApps
{
    public partial class FormProgressBar : Form
    {
        public FormProgressBar(string title, string description, bool hasProgression)
        {
            InitializeComponent();
            lblDescription.Text = description;
            if (string.IsNullOrEmpty(title))
                Text = ProductName;
            else
                Text = ProductName + ": " + title;
            timer.Enabled = !hasProgression;
            progressBar.Value = 0;
        }

        public void ProgressChanged(string description, int progressPercentage)
        {
            if (!string.IsNullOrEmpty(description))
                lblDescription.Text = description;
            else
                lblDescription.Text = string.Empty;
                progressBar.Value = progressPercentage;
            progressBar.Refresh();
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            progressBar.Value += 5;
            if (progressBar.Value == 100)
                progressBar.Value = 0;
        }

        private void FormProgressBar_Load(object sender, EventArgs e)
        {

        }
    }
}
